import concurrent.futures


class jobTriggerPoolHelper:

    def __init__(self):
        self.logger = None
        self.fastTriggerPool = None
        self.slowTriggerPool = None
        self.minTim = None
        self.jobTimeoutCountMap = None
        self.helper = None

    # 启动 触发器线程池： 快慢两个线程池
    def start(self):
        self.fastTriggerPool = concurrent.futures.ThreadPoolExecutor(max_workers=10).submit()
        self.slowTriggerPool = concurrent.futures.ThreadPoolExecutor(max_workers=10).submit()

    def stop(self):
        self.fastTriggerPool.stop()
        self.slowTriggerPool.stop()

    def addTrigger(self, jobId, triggerType, executorParam):
        self.fastTriggerPool.submit(
            jobTrigger.trigger(jobId, triggerType, executorParam)
        )

